﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Data;

namespace DAL.Service
{
    /// <summary>
    /// <para>作者：陈镜 </para>  
    /// <para>日期：2011-3-8 </para>  
    /// </summary>
    public interface IBaseService
    {
        /// <summary>
        /// 保存实体类
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Object save(Object entity);

        /// <summary>
        /// 删除实体类
        /// </summary>
        /// <param name="entity"></param>
        void delete(Object entity);

        /// <summary>
        /// 获取一个实体
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        object getEntity(object id, string entityname);

        /// <summary>
        /// 获取一个实体
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        IList getEntities(string ids, string entityname);

        /// <summary>
        /// 获取一个实体，传hql
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        object getEntity(MyQuery query);

        /// <summary>
        /// 获取一个实体，传sql
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        object getEntity(MyQuery query,string entityName);

        /// <summary>
        /// 获取hashtable列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        IList getList(MyQuery query);

        /// <summary>
        /// 读取表里所有数据
        /// </summary>
        /// <param name="tableName"></param>
        /// <returns></returns>
        IList getList(string tableName);

        /// <summary>
        /// 获取第一行第一列
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        object getScalar(MyQuery query);

        IList getList(string storedprocedure_name, MyQuery query);

        /// <summary>
        /// 获取分页列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        IList getPageList(MyQuery query);

        DataTable getDataTable(MyQuery query);


        /// <summary>
        /// 返回受影响的行数
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        int exeUpdateSql(MyQuery query);

        int exeUpdateSql(string storedprocedure_name, MyQuery query);
 
    }
}
